const userModel = require('../model/user')

//用户注册
exports.register = async (req, res, next) => {
  try{
    //处理请求
    let regRes = await userModel.register(req.body.user, next)
    res.status('201').json(regRes)
  }catch (err){
    next(err)
  }
}

//用户登录
exports.login = async (req, res, next)=>{
  try{
    //处理请求
    res.send('post /users/login')
  }catch (err){
    next(err)
  }
}

exports.getCurrentUser = async (req, res, next)=>{
  try{
    //处理请求
    res.send('get /users')
  }catch (err){
    next(err)
  }
}

exports.updateCurrentUser  = async (req, res, next)=>{
  try{
    //处理请求
    res.send('put /user')
  }catch (err){
    next(err)
  }
}